import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  { path: '/', redirect: '/layout' },
  { path: '/login', component: () => import('../views/login/login.vue') },
  {
    path: '/layout',
    component: () => import('../views/layout/index.vue'),
    redirect: '/layout/userManege/statistics',
    children: [
      {
        path: 'userManege/healthReport',
        component: () => import('../views/userManage/healthReport/index.vue')
      },
      {
        path: 'userManege/goods',
        component: () => import('../views/userManage/goods/goods.vue')
      },
      {
        path: 'userManege/statistics',
        component: () => import('../views/userManage/statistics/statistics.vue')
      },
      {
        path: 'userManege/message',
        component: () => import('../views/userManage/message/message.vue')
      },
      {
        path: 'goods/goodsApprove',
        component: () => import('../views/goods/goodsApprove/goodsApprove.vue')
      },
      {
        path: 'goods/goodsPurchase',
        component: () =>
          import('../views/goods/goodsPurchase/goodsPurchase.vue')
      },
      {
        path: 'user',
        component: () => import('../views/user/user.vue')
      },
      {
        path: 'resident',
        component: () => import('../views/resident/resident.vue')
      }
    ]
  }
]

const router = createRouter({
  routes,
  history: createWebHashHistory()
})

export default router
